/* 
 * Block Cache Layer
 * 
 * cache.h
 *
 * Cache of blocks.
 * 
 */

#include "../uthash/uthash.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "../include/sthread.h"
#include "../include/block.h"
#include "../include/cache.h"
#define CACHE_SIZE 2000
#define CACHE_BLOCK_SIZE 512




/*
 * cache_init: initialize block/register cache
 * - allocator: the blocks/registers instance to be cached
 *
 */
void cache_init(DISK_TYPE* allocator) {
  //TO DO: IMPLEMENT THIS FUNCTION
  return ;
}



/*
 * cache_read: read a whole block/register
 * - no: the number of the block/register to read
 * - block: the buffer were to copy the block/register 
 *   returns: 0 if sucessful, -1 if not
 */
int cache_read(unsigned block_no,	char* block) {
  //TO DO: IMPLEMENT THIS FUNCTION
  return -1;
}

/*
 * cache_write: write a whole block/register
 * - no: the number of the block/register to write
 * - block: the data with the data to write
 *   returns: 0 if sucessful, -1 if not
 */
int cache_write(unsigned block_no, char* block) {
  //TO DO: IMPLEMENT THIS FUNCTION
  return -1;
}


/*
 * cache_block_flush: forces flush of any dirty cache block/register
 */
void cache_flush() {
  //TO DO: IMPLEMENT THIS FUNCTION
  return ;
}

/*
 * cache_dump_stats: display statics of the cache
 */
void cache_dump_stats() {
  //TO DO: IMPLEMENT THIS FUNCTION
  return ;
}


